import request from '@/utils/request'

export function loginByUsername(username, password) {
  return request({
    url: '/admin/auth/token',
    method: 'post',
    data: {
      username,
      password
    }
  })
}

export function getUserInfo(token) {
  return request({
    url: '/admin/user/userinfo',
    method: 'get',
    params: { token }
  })
}

export function logout(token) {
  return request({
    url: '/admin/auth/invalid',
    method: 'post',
    params: { token }
  })
}

export function getMenus(token) {
  return request({
    url: '/admin/user/menus',
    method: 'get',
    params: { token }
  })
}

export function getAllMenus() {
  return request({
    url: '/admin/user/menu/all',
    method: 'get'
  })
}
